/*
struct TreeNode {
	int val;
	struct TreeNode *left;
	struct TreeNode *right;
	TreeNode(int x) :
			val(x), left(NULL), right(NULL) {
	}
};*/
class Solution {
public:
    int TreeDepth(TreeNode* pRoot) {//DFS思想结题
        int ret=0;
        if(pRoot==NULL)
            return ret;
        DFS(pRoot,0,ret);
        return ret;
    }
    void DFS(TreeNode* p,int n,int &ret){
        n++;
        if(n>ret)
            ret=n;
        if(p->left!=NULL)
            DFS(p->left,n,ret);
        if(p->right!=NULL)
            DFS(p->right,n,ret);
    }
};